################################################################################
#    File: main.py
#    Created: 4/6/09
#
#    Initial coding by Kyle Corbitt
#
#    Source released under the MIT permissive license. More information
#    available at (http://en.wikipedia.org/wiki/MIT_License).
#
#    Description:    This is the primary module in the COR Groundstation suite.
#                    it is responsible for generating the application ands
#                    loading other modules as necessary.
################################################################################

import wx #the wx library is used to generate all GUI elements
import menus #this module contains the tasks in the drop-down menus
import comms #this module lets us read comms status
import sidebar #contains the sidebar GUI elements
import navigation #contains the navigation/route planning pane GUI elements

WINDOW_TITLE = "COR Groundstation for ArduPilot"

#This overarching panel contains all other elements
class primaryPanel(wx.Panel):
    def __init__(self, parent, id=wx.ID_ANY):
        wx.Panel.__init__(self, parent, id)

        layoutSizer = wx.BoxSizer(wx.HORIZONTAL) #Sizer for the sidebar and nav panes

        sidebarPanel = sidebar.sidebar(self) #sidebar
        layoutSizer.Add(sidebarPanel, 0, wx.EXPAND, 0)

        navPanel = navigation.navPanel(self) #navigation/routing panel
        layoutSizer.Add(navPanel, 1, wx.EXPAND, 0)

        self.SetSizer(layoutSizer)

        #sidebarPanel.UpdateSidebar()


#The frame containing the primary panel
class primaryFrame(wx.Frame):
    def __init__(self, parent, title, id=wx.ID_ANY, pos=(-1,-1), size=(-1,-1)):
        wx.Frame.__init__(self, parent, id, title, pos, size)
        self.SetMenuBar(menus.menuBar()) #load the menu bar
        panel = primaryPanel(self) #the overarching panel containing all other elements
        self.Maximize()

        #self.SetStatusBar(primaryStatusBar()) #load the status bar

#Status bar displays GPS coordinates of the mouse
#class primaryStatusBar(wx.StatusBar):
#    def __init__(self):
#        wx.StatusBar.__init__(self, PRIMARY_FRAME_ID, -1, wx.SB_NORMAL, "")

class primaryApp(wx.App):
    def OnInit(self):
        frame = primaryFrame(None, WINDOW_TITLE)
        frame.Show(True)
        self.SetTopWindow(frame)
        return True

app = primaryApp(0)
app.MainLoop()